package homework;
import static org.junit.Assert.*;
import org.junit.*;

public class UnitTest {
        private Calculator calculator;
        @Before
        public void setUp(){
                calculator = new Calculator();
        }
        @After
        public void tearDown(){
                calculator = null;
        }
        @Test
        public void test(){
                
                //加法測試 :1+2+3,預期結果:6 
                int expected = 6;
                int result = calculator.sum(1, 2, 3);
                assertEquals(expected, result);
                                
                //減法測試:99-60-30,預期結果:9 
                expected = 9;
                result = calculator.minus(99, 60, 30);
                assertEquals(expected, result);
                
                //乘法測試:2X2X2,預期結果:8
                expected = 8;
                result = calculator.times(2, 2, 2);
                assertEquals(expected, result);
                                
                //除法測試:1000%10%10,預期結果:10
                expected = 10;
                result = calculator.divide(1000, 10, 10);
                assertEquals(expected, result);
                                
                //最大值測試:99,100,-130,預期結果:100
                expected = 100;
                result = calculator.max(99, 100, -130);
                assertEquals(expected, result);
                                
                //最小值測試:-9,60,30,預期結果:-9
                expected = -9;
                result = calculator.min(-9, 60, 30);
                assertEquals(expected, result);
                                
                //平均值測試:2,4,6,預期結果:4
                expected = 4;
                result = calculator.average(2, 4, 6);
                assertEquals(expected, result);
                                
                //次方測試:2^3,預期結果:8
                expected = 8;
                result = calculator.power(2, 3);
                assertEquals(expected, result);
        }
}